
#include "HttpCmdGetCmdList.h"


CHttpCmdGetCmdList::CHttpCmdGetCmdList()
{ 
    m_CmdList.clear();
    m_CmdList = {
        "GetDateTime",
        "GetIfconfig" ,
        "GetShellResult",
        "GetCmdList"
    };
}


CHttpCmdGetCmdList::~CHttpCmdGetCmdList()
{

}

bool CHttpCmdGetCmdList::CheckParamVaild(const std::string &strReqMessage)
{
    return true;
}

bool CHttpCmdGetCmdList::FillRspData(std::string &strRspData)
{
    // need some system helper functions
    neb::CJsonObject rspJsonObj;
    rspJsonObj.AddEmptySubObject("Data");
    neb::CJsonObject &dataJsonObj = rspJsonObj["Data"];

    dataJsonObj.AddEmptySubArray("CmdList");

    neb::CJsonObject &cmdListJsonObj = dataJsonObj["CmdList"];

    auto iter = m_CmdList.cbegin();
    for (; iter != m_CmdList.cend(); ++iter)
    {
        cmdListJsonObj.Add(*iter);
    }
    

    strRspData = rspJsonObj.ToString();
}
